package snuggle.jabber.listeners;

import java.util.Collection;

import org.apache.log4j.Logger;
import org.jivesoftware.smack.RosterListener;
import org.jivesoftware.smack.packet.Presence;

public class RostList implements RosterListener {
	
	private static Logger logger = Logger.getLogger(RostList.class);

	public RostList() {
		super();
	}

	@Override
	public void entriesAdded(Collection<String> arg0) {
		for(String arg : arg0) 
			logger.info("Entry created: " + arg);
	}

	@Override
	public void entriesDeleted(Collection<String> arg0) {
		for(String arg : arg0)
			logger.info("Entry Deleted: " + arg);
	}

	@Override
	public void entriesUpdated(Collection<String> arg0) {
		for(String arg : arg0) 
			logger.info("Entry updated: " + arg);
	}

	@Override
	public void presenceChanged(Presence arg0) {
		if(arg0.isAvailable())
			logger.info("User online: " + arg0.getFrom());
		else 
			logger.info("User offline." + arg0.getFrom());
	}

}
